package com.corning.patient.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.corning.patient.entity.ArchivesEntity;
import com.corning.patient.service.ArchivesService;
import com.corning.common.utils.PageUtils;
import com.corning.common.utils.R;



/**
 * 
 *
 * @author wtt
 * @email 1239115389@qq.com
 * @date 2022-03-20 15:16:34
 */
@RestController
@RequestMapping("patient/archives")
public class ArchivesController {
    @Autowired
    private ArchivesService archivesService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = archivesService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{archId}")

    public R info(@PathVariable("archId") Integer archId){
		ArchivesEntity archives = archivesService.getById(archId);

        return R.ok().put("archives", archives);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody ArchivesEntity archives){
		archivesService.save(archives);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ArchivesEntity archives){
		archivesService.updateById(archives);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")

    public R delete(@RequestBody Integer[] archIds){
		archivesService.removeByIds(Arrays.asList(archIds));

        return R.ok();
    }

}
